<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:62:"E:\WWW\movie.cc\public/../application/admin\view\log\edit.html";i:1682061466;}*/ ?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
    <form class="layui-form">
        <div class="mainBox">
            <div class="main-container">
            
                <div class="layui-form-item">
                      <label class="layui-form-label">会员等级</label>
                      <div class="layui-input-block">
                        <select name="vip" lay-verify="required">
                          <option value="">选择会员等级</option>
                          <option value="0" <?php echo $data['vip']=='0'?'selected':''; ?>>普通用户</option>
                          <option value="1" <?php echo $data['vip']=='1'?'selected':''; ?>>月度会员</option>
                          <option value="2" <?php echo $data['vip']=='2'?'selected':''; ?>>季度会员</option>
                          <option value="3" <?php echo $data['vip']=='3'?'selected':''; ?>>年度会员</option>
                          <option value="4" <?php echo $data['vip']=='4'?'selected':''; ?>>永久会员</option>
                        </select>
                      </div>
                </div>
                <div class="layui-form-item">
                      <label class="layui-form-label">金额</label>
                      <div class="layui-input-block">
                        <input type="hidden" name="uid" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $data['uid']; ?>">
                        <input type="text" name="money" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $data['money']; ?>">
                      </div>
                </div>
                <div class="layui-form-item">
                      <label class="layui-form-label">开始时间</label>
                      <div class="layui-input-block">
                        <input type="text" name="begin" lay-verify="required" id="begin" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $data['begintime']; ?>">
                      </div>
                </div>
                <div class="layui-form-item">
                      <label class="layui-form-label">结束时间</label>
                      <div class="layui-input-block">
                        <input type="text" name="end" lay-verify="required" id="end" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $data['endtime']; ?>">
                      </div>
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="button-container">
                <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>

<script src="/static/js/jquery-1.8.3.min.js"></script>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script>

layui.use(['form','jquery','upload','element','laydate'],function(){
    let form = layui.form;
    let upload = layui.upload;
    let laydate = layui.laydate;
    let element = layui.element;
    let $ = layui.jquery;

    laydate.render({ 
      elem: '#begin',
      type:'date'
    });
    laydate.render({ 
      elem: '#end',
      type:'date'
    });
     //自定义验证规则
    // form.verify({
    //   username:[/^[A-Za-z0-9_]{6,12}$/,'用户名必须是6到12位，由字母下划线数字组成'],
    //   pass: [/^[\S]{6,12}$/,'密码必须6到12位，且不能出现空格'],
    //   num:[/^\d+$/,'得是整数'],
    //   price:[/(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/,'注意价格格式'],
    //   head_portrait:function(value){
    //     if(!value){
    //       return '请上传头像';
    //     }
    //   }
    // });
    form.on('submit(save)', function(data){
        console.log(data.field)
        // return;
        $.ajax({
            data:JSON.stringify(data.field),
            dataType:'json',
            contentType:'application/json',
            type: 'post',
            success:function(res){
                if(res.code==1){
                    layer.msg(res.msg,{icon:1,time:1000},function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("dataTable");
                    });
                }else{
                    layer.msg(res.msg,{icon:2,time:1000});
                }
            }
        })
        return false;
    });
})
</script>
</body>
</html>